/*
 * @Author: Quinn
 * @Date: 2023-05-11 22:33:18
 * @LastEditors: quinn
 * @Description:
 */
import Vue from "vue";
import VueRouter from "vue-router";
import extender from "./routerExtend";
import { HOME_PATH } from "@/assets/js/define.js";
import { menuRoutes } from "./menu";

Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
const routes = [
  {
    path: "",
    redirect: HOME_PATH,
  },
  ...menuRoutes,
];

let router = new VueRouter({
  mode: "hash",
  base: "/",
  routes,
});
router = extender(router);

export default router;
